#ifndef TIMER_H
#define TIMER_H

#include <chrono>
#include <iostream>
#include <thread>

struct Timer
{
    std::string event;
    std::chrono::time_point<std::chrono::steady_clock> start, end;
    std::chrono::duration<double> duration;
    int test_time;
    Timer(const std::string &event, int test_time = 1) : event(event), test_time(test_time)
    {
        start = std::chrono::steady_clock::now();
    }
    ~Timer()
    {
        end = std::chrono::steady_clock::now();
        duration = end - start;

        double ms = duration.count() * (double)1000.0;
        std::cout << event << " took " << ms / test_time << "ms." << std::endl;
    }
};

#endif